<?php
/**
 * Albireo library
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */
namespace Albireo;

use Nette\Object;
use Nette\Forms\Form;

use Albireo\Forms\AlbireoForm;

/**
 * Datepicker class
 *
 * @author     pavel
 * @package    Kernel
 */
class DatePicker extends Object {

    /**
     *
     * @param ComponentContainer $masterClass the ComponentContainer (usually
     *          Presenter, which uses the jQuery DatePicker)
     * @return AlbireoForm the datepicker form
     */
    public function getDatePicker($masterClass) {
        $form = new AlbireoForm();
	$form->elementPrototype->class("inlineForm");
        $form->addText('date', _('Search by date:'))->addRule(Form::FILLED, _('Enter a date to search (format: yyyy-mm-dd).'));

        //$form['date']->setOption('container', Html::el('div')->class('block form')->id('wep_params'));

        $form->addSubmit('ok', _('Search'));

        $form->onSubmit[] = array($masterClass, 'datePickerSubmitted');

        return $form;
    }
}
